package com.stus.mapper;

import com.stus.model.Member;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by Alias on 2016/4/11.
 */
@Service
public class MemberMapper implements RowMapper{
    @Autowired
    private Member member;
    @Override
    public Member mapRow(ResultSet resultSet, int i) throws SQLException {
        member.setAccount(resultSet.getString("accout"));
        member.setPassword(resultSet.getString("password"));
        member.setUsername(resultSet.getString("username"));
        member.setAddress(resultSet.getString("address"));
        member.setPhone(resultSet.getString("phone"));
        member.setType(resultSet.getString("type"));
        return member;
    }
}
